class Solution {
    public int integerBreak(int n) {
        if(n == 2)  return 1;
        if(n == 3)  return 2;

        int res = n / 3;
        int rem = n % 3;
        if(rem == 0){
            return (int)Math.pow(3,res);
        }
        else if(rem == 1){
            return (int)(4 * Math.pow(3, res-1));
        }
        else{
            return (int)(2 * Math.pow(3, res));
        }
    }
}